#!/bin/bash

curl -fsSL https://get.docker.com -o docker.sh #sh冗余文件
sudo sh  docker.sh --mirror Aliyun #执行 并从aliyun下载安装

#systemctl status | start |stop | restart docker
sudo systemctl status docker

#开机启动服务
sudo systemctl enable docker

#docker命令通信使用unix socket 默认是需要root用户才能unix socket
sudo groupadd docker
sudo usermod -aG docker $USER

#镜像加速器
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://x8yh7m8b.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker
